document.addEventListener('DOMContentLoaded', () => {
    chrome.storage.local.get('currentRequest', (data) => {
      const requestInfo = document.getElementById('requestInfo');
      const downloadButton = document.getElementById('downloadButton');
      const request = data.currentRequest;
  
      if (request) {
        requestInfo.textContent = `${request.method} ${request.url}`;
        downloadButton.style.display = 'block'; // 显示下载按钮
  
        downloadButton.addEventListener('click', () => {
          chrome.downloads.download({ url: request.url, filename: request.url.split('/').pop() });
        });
      } else {
        requestInfo.textContent = '没有当前请求记录';
      }
    });
  });